package com.cy.pj.sys.service.impl;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cy.pj.sys.dao.SysMsgDao;
import com.cy.pj.sys.dao.SysUserDao;
import com.cy.pj.sys.entity.SysMsg;
import com.cy.pj.sys.service.SysMsgService;

@Service
public class SysMsgServiceImpl implements SysMsgService{

	@Autowired
	private SysMsgDao sysMsgDao;
	@Autowired
	private SysUserDao sysUserDao;
	
	@Override
	public int saveMsg(Integer id, String msg) {
		SysMsg sysMsg = new SysMsg();
		String username = sysUserDao.findUsernameById(1).getUsername();
		sysMsg.setUsername(username);
		sysMsg.setMsg(msg);
		Integer saveMsg = sysMsgDao.saveMsg(sysMsg);
		return saveMsg;
	}

	@Override
	public List<SysMsg> showMsg() {
		List<SysMsg> showMsg = sysMsgDao.showMsg();
		return showMsg;
	}
	

}
